package fr.afcepf.atod18.commande.service;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import fr.afcepf.atod18.commande.entity.EtatCommande;
import fr.afcepf.atod18.commande.jms.JmsProducer;


public class TestProducer {
    
    public static void main(String[] args) {
        @SuppressWarnings("resource")
        ApplicationContext context = new ClassPathXmlApplicationContext("springConf.xml");
        IServiceEtatCommande serviceEtatCommande = (IServiceEtatCommande) context.getBean("serviceEtatCommande");
        System.out.println("envoi du message");
        EtatCommande etatCommande = serviceEtatCommande.rechercherParId(1);
        JmsProducer jmsProducer = (JmsProducer) context.getBean("jmsProducer");
        jmsProducer.envoyerMessage(3, etatCommande);

//        try {
//          System.out.println("arret activeMQ");
//          System.in.read();
//          System.out.println("relance activeMQ");
//          System.in.read();
//        } catch (IOException e) {
//          e.printStackTrace();
//        }

    }
}